/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.erickpardal.game.fpsdemo.util;

import java.util.ArrayList;

import com.jme.scene.Geometry;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
import com.jme.scene.VBOInfo;
import java.util.Iterator;

/**
 *
 * @author Erick Pardal
 *
 */
public class VBOUtil {

    public static void enableVBOonTree(Spatial treeRoot) {
        if (treeRoot instanceof Node) {
            Node treeNode = (Node)treeRoot;
            Iterator children = treeNode.getChildren().iterator();
            while (children.hasNext()) {
                enableVBOonTree((Spatial)children.next());
            }
        } else if (treeRoot instanceof Geometry) {
            Geometry g = (Geometry)treeRoot;
            g.setVBOInfo(new VBOInfo(true));
        }
    }

}
